"use strict";
cc._RF.push(module, 'c5c8cWHi+dNWpeCH5A4oaZm', 'GbzRankLayer');
// scripts/layer/GbzRankLayer.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var GbzEnum_1 = require("../GbzEnum");
var GbzInstance_1 = require("../GbzInstance");
var GbzAudioManager_1 = require("../manager/GbzAudioManager");
var GbzSdkManager_1 = require("../manager/GbzSdkManager");
var GbzToastManager_1 = require("../manager/GbzToastManager");
var GbzBaselayer_1 = require("./GbzBaselayer");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var GbzRankLayer = /** @class */ (function (_super) {
    __extends(GbzRankLayer, _super);
    function GbzRankLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.panel = null;
        _this.btn_close = null;
        // btn_share: cc.Node = null
        _this.btn_solid = null;
        return _this;
    }
    GbzRankLayer.prototype.onLoad = function () {
        this.panel = cc.find('style/panel', this.node);
        this.btn_solid = cc.find('btn_solid', this.panel);
        this.btn_solid.on('click', this.onSide, this);
        this.btn_close = cc.find('btn_close', this.panel);
        this.btn_close.on('click', this.onClose, this);
        // this.btn_share = cc.find('btn_share', this.panel)
        // this.btn_share.on('click', this.onShare, this)
    };
    GbzRankLayer.prototype.onDestroy = function () {
        this.btn_close.off('click', this.onClose, this);
        // this.btn_share.off('click', this.onShare, this)
    };
    GbzRankLayer.prototype.onEnable = function () {
        this.zoom(this.panel);
        GbzSdkManager_1.default.ins.getRank();
        GbzSdkManager_1.default.ins.showInter();
        GbzSdkManager_1.default.ins.showBanner(true);
    };
    GbzRankLayer.prototype.onDisable = function () {
        GbzSdkManager_1.default.ins.showBanner(false);
    };
    GbzRankLayer.prototype.onSide = function () {
        var _this = this;
        tt.navigateToScene({
            scene: "sidebar",
            success: function (res) {
                _this.onClose();
            },
            fail: function (res) {
                _this.onClose();
            },
        });
    };
    GbzRankLayer.prototype.onClose = function () {
        GbzAudioManager_1.default.ins.play(GbzEnum_1.ENUM_CLIP.GAME_CLICK);
        GbzInstance_1.default.uiMgr.toggle(GbzEnum_1.ENUM_UI.LAYER_RANK, false);
        GbzInstance_1.default.uiMgr.toggle(GbzEnum_1.ENUM_UI.LAYER_MENU);
    };
    GbzRankLayer.prototype.onShare = function () {
        GbzAudioManager_1.default.ins.play(GbzEnum_1.ENUM_CLIP.GAME_CLICK);
        if (GbzSdkManager_1.default.ins.platform()) {
            GbzSdkManager_1.default.ins.activeShare();
        }
        else {
            GbzToastManager_1.default.ins.show('仅支持小游戏平台', { gravity: 'TOP', bg_color: cc.color(102, 202, 28, 255) });
        }
    };
    GbzRankLayer = __decorate([
        ccclass
    ], GbzRankLayer);
    return GbzRankLayer;
}(GbzBaselayer_1.default));
exports.default = GbzRankLayer;

cc._RF.pop();